package de.wesemann.jdedun.entities.district.streets;

import de.wesemann.jdedun.entities.AbstractEntity;

/**
 * The Street in a district
 * 
 * @author spinner0815
 * 
 */
public class DistrictStreet extends AbstractEntity {

    private int district_id;
    private int internal_key;
    private String name;
    private int housenumber;
    private String housenumber_additional;
    private String postcode;

    /**
     * id des Stadtteils
     * 
     * @return the district_id
     */
    public int getDistrict_id() {
	return district_id;
    }

    /**
     * id des Stadtteils
     * 
     * @param district_id
     *            the district_id to set
     */
    public void setDistrict_id(int district_id) {
	this.district_id = district_id;
    }

    /**
     * interne Bezeichnung der Stadt Leipzig
     * 
     * @return the internal_key
     */
    public int getInternal_key() {
	return internal_key;
    }

    /**
     * interne Bezeichnung der Stadt Leipzig
     * 
     * @param internal_key
     *            the internal_key to set
     */
    public void setInternal_key(int internal_key) {
	this.internal_key = internal_key;
    }

    /**
     * Straßennname
     * 
     * @return the name
     */
    public String getName() {
	return name;
    }

    /**
     * Straßennname
     * 
     * @param name
     *            the name to set
     */
    public void setName(String name) {
	this.name = name;
    }

    /**
     * Hausnummer (nur Zahl)
     * 
     * @return the housenumber
     */
    public int getHousenumber() {
	return housenumber;
    }

    /**
     * Hausnummer (nur Zahl)
     * 
     * @param housenumber
     *            the housenumber to set
     */
    public void setHousenumber(int housenumber) {
	this.housenumber = housenumber;
    }

    /**
     * Zusatz zur Hausnummer, wie z.B a, Tor B, Hinterhof
     * 
     * @return the housenumber_additional
     */
    public String getHousenumber_additional() {
	return housenumber_additional;
    }

    /**
     * Zusatz zur Hausnummer, wie z.B a, Tor B, Hinterhof
     * 
     * @param housenumber_additional
     *            the housenumber_additional to set
     */
    public void setHousenumber_additional(String housenumber_additional) {
	this.housenumber_additional = housenumber_additional;
    }

    /**
     * 5-stellige Postleitzahl
     * 
     * @return the postcode
     */
    public String getPostcode() {
	return postcode;
    }

    /**
     * 5-stellige Postleitzahl
     * 
     * @param postcode
     *            the postcode to set
     */
    public void setPostcode(String postcode) {
	this.postcode = postcode;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
	final int prime = 31;
	int result = super.hashCode();
	result = prime * result + district_id;
	result = prime * result + housenumber;
	result = prime
		* result
		+ ((housenumber_additional == null) ? 0
			: housenumber_additional.hashCode());
	result = prime * result + internal_key;
	result = prime * result + ((name == null) ? 0 : name.hashCode());
	result = prime * result
		+ ((postcode == null) ? 0 : postcode.hashCode());
	return result;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
	if (this == obj) {
	    return true;
	}
	if (!super.equals(obj)) {
	    return false;
	}
	if (getClass() != obj.getClass()) {
	    return false;
	}
	DistrictStreet other = (DistrictStreet) obj;
	if (district_id != other.district_id) {
	    return false;
	}
	if (housenumber != other.housenumber) {
	    return false;
	}
	if (housenumber_additional == null) {
	    if (other.housenumber_additional != null) {
		return false;
	    }
	} else if (!housenumber_additional.equals(other.housenumber_additional)) {
	    return false;
	}
	if (internal_key != other.internal_key) {
	    return false;
	}
	if (name == null) {
	    if (other.name != null) {
		return false;
	    }
	} else if (!name.equals(other.name)) {
	    return false;
	}
	if (postcode == null) {
	    if (other.postcode != null) {
		return false;
	    }
	} else if (!postcode.equals(other.postcode)) {
	    return false;
	}
	return true;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
	StringBuilder builder = new StringBuilder();
	builder.append("DistrictStreet [district_id=");
	builder.append(district_id);
	builder.append(", internal_key=");
	builder.append(internal_key);
	builder.append(", name=");
	builder.append(name);
	builder.append(", housenumber=");
	builder.append(housenumber);
	builder.append(", housenumber_additional=");
	builder.append(housenumber_additional);
	builder.append(", postcode=");
	builder.append(postcode);
	builder.append("]");
	return builder.toString();
    }
}
